package cn.itmtr.screenshot.service.impl;

import cn.hutool.core.util.StrUtil;
import cn.hutool.system.SystemUtil;
import cn.itmtr.screenshot.service.IScreenshotService;

/**
 * 网页截图Linux实现
 *
 * @author mtr
 * @since 2021-09-24
 */
public class ScreenshotLinuxServiceImpl implements IScreenshotService {

    @Override
    public String getImageDefaultPath() {
        String currentDir = SystemUtil.getUserInfo().getCurrentDir();
        return currentDir + System.currentTimeMillis() + ".png";
    }

    @Override
    public String getPhantomjsCmd() {
        String base = "/opt/phantomjs/phantomjs-2.1.1-linux-x86_64/";
        return StrUtil.format("{}{} {}{}", base, "bin/phantomjs", base, "examples/rasterize.js");
    }

}
